package cn.wolfcdoe.business.service.impl;

import java.util.List;

import cn.wolfcdoe.common.core.domain.entity.SysUser;
import cn.wolfcdoe.common.utils.DateUtils;
import cn.wolfcdoe.common.utils.SecurityUtils;
import cn.wolfcdoe.system.service.ISysUserService;
import cn.wolfcdoe.system.service.impl.SysUserServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import cn.wolfcdoe.business.mapper.BusCustomerMessageMapper;
import cn.wolfcdoe.business.domain.BusCustomerMessage;
import cn.wolfcdoe.business.service.IBusCustomerMessageService;

import javax.annotation.Resource;

/**
 * 客户信息Service业务层处理
 * 
 * @author zhuo
 * @date 2023-04-22
 */
@Service
public class BusCustomerMessageServiceImpl implements IBusCustomerMessageService 
{
    @Autowired
    private BusCustomerMessageMapper busCustomerMessageMapper;

    @Resource
    private SysUserServiceImpl sysUserService;

    /**
     * 查询客户信息
     * 
     * @param id 客户信息主键
     * @return 客户信息
     */
    @Override
    public BusCustomerMessage selectBusCustomerMessageById(Long id)
    {
        return busCustomerMessageMapper.selectBusCustomerMessageById(id);
    }

    /**
     * 查询客户信息列表
     * 
     * @param busCustomerMessage 客户信息
     * @return 客户信息
     */
    @Override
    public List<BusCustomerMessage> selectBusCustomerMessageList(BusCustomerMessage busCustomerMessage)
    {
        return busCustomerMessageMapper.selectBusCustomerMessageList(busCustomerMessage);
    }

    /**
     * 新增客户信息
     * @return 结果
     */
    @Override
    public int insertBusCustomerMessage(BusCustomerMessage busCustomerMessage)
    {
        busCustomerMessage.setEnteringPerson(SecurityUtils.getUserId().toString());
        busCustomerMessage.setEnteringTime(DateUtils.getNowDate());
        return busCustomerMessageMapper.insertBusCustomerMessage(busCustomerMessage);
    }

    /**
     * 修改客户信息
     * 
     * @param busCustomerMessage 客户信息
     * @return 结果
     */
    @Override
    public int updateBusCustomerMessage(BusCustomerMessage busCustomerMessage)
    {
        return busCustomerMessageMapper.updateBusCustomerMessage(busCustomerMessage);
    }

    /**
     * 批量删除客户信息
     * 
     * @param ids 需要删除的客户信息主键
     * @return 结果
     */
    @Override
    public int deleteBusCustomerMessageByIds(Long[] ids)
    {
        return busCustomerMessageMapper.deleteBusCustomerMessageByIds(ids);
    }

    /**
     * 删除客户信息信息
     * 
     * @param id 客户信息主键
     * @return 结果
     */
    @Override
    public int deleteBusCustomerMessageById(Long id)
    {
        return busCustomerMessageMapper.deleteBusCustomerMessageById(id);
    }

    /**
     * 查询所有的用户信息
     * @return
     */
    @Override
    public List<SysUser> getUserListAll() {

        return sysUserService.selectUserListAll();
    }
}
